import config from '../config/config';
import request from '../utils/request';

let service = {};

// 海外直邮列表
service.getZyGoodsList = (param, cb) => {
  param = param || {};
  let requestUrl = config.api.getZyGoodsList;
  request({
    url: requestUrl,
    showLoading: true,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    }
  });
}

// 分类名称列表
service.categorylist = (param, cb) => {
  param = param || {};
  let requestUrl = config.api.categorylist;
  request({
    url: requestUrl,
    // showLoading: true,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    }
  });
}

//分类下属列表
service.customercategory = (param, cb) => {
  param = param || {};
  let requestUrl = config.api.customercategory;
  request({
    url: requestUrl,
    showLoading: true,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    }
  });
}

//搜索列表
service.customerSearch = (param, cb) => {
  param = param || {};
  let requestUrl = config.api.customerSearch;
  request({
    url: requestUrl,
    showLoading: true,
    data: param,
    method: 'POST',
    success: res => {
      cb(res);
    }
  });
}

//搜索历史
service.customerSearchhistory = (param, cb) => {
  param = param || {};
  let requestUrl = config.api.customerSearch;
  request({
    url: requestUrl,
    // showLoading: true,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    }
  });
}

//热门搜索
service.hotkeyword = (param, cb) => {
  param = param || {};
  let requestUrl = config.api.hotkeyword;
  request({
    url: requestUrl,
    // showLoading: true,
    data: param,
    method: 'GET',
    success: res => {
      cb(res);
    }
  });
}

module.exports = service;